import 'dart:convert' show json;


class UserInfo {

  int page;
  bool isNonProfit;
  String name;
  String url;
  List<Links> links;
  Address address;


  UserInfo.fromParams({this.page, this.isNonProfit, this.name, this.url, this.links, this.address});

  factory UserInfo(jsonStr) => jsonStr is String ? UserInfo.fromJson(json.decode(jsonStr)) : UserInfo.fromJson(jsonStr);

  UserInfo.fromJson(jsonRes) {
    page = jsonRes['page'];
    isNonProfit = jsonRes['isNonProfit'];
    name = jsonRes['name'];
    url = jsonRes['url'];
    links = [];

    for (var linksItem in jsonRes['links']){

      links.add(new Links.fromJson(linksItem));
    }

    address = new Address.fromJson(jsonRes['address']);

  }

  @override
  String toString() {
    return '{"page": $page,"isNonProfit": $isNonProfit,"name": ${name != null?'${json.encode(name)}':'null'},"url": ${url != null?'${json.encode(url)}':'null'},"links": $links,"address": $address}';
  }
}



class Address {

  String city;
  String country;
  String street;


  Address.fromParams({this.city, this.country, this.street});

  Address.fromJson(jsonRes) {
    city = jsonRes['city'];
    country = jsonRes['country'];
    street = jsonRes['street'];

  }

  @override
  String toString() {
    return '{"city": ${city != null?'${json.encode(city)}':'null'},"country": ${country != null?'${json.encode(country)}':'null'},"street": ${street != null?'${json.encode(street)}':'null'}}';
  }
}



class Links {

  String name;
  String url;


  Links.fromParams({this.name, this.url});

  Links.fromJson(jsonRes) {
    name = jsonRes['name'];
    url = jsonRes['url'];

  }

  @override
  String toString() {
    return '{"name": ${name != null?'${json.encode(name)}':'null'},"url": ${url != null?'${json.encode(url)}':'null'}}';
  }
}

